﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="ManageUsers.aspx.cs" Inherits="Administration_ManageUsers" Title="Crux - Manage Users"
    CodeFileBaseClass="BaseView" ViewName="ManageUsers" %>

<%@ Register Src="../Controls/Common/WaterMarkedTextBox.ascx" TagName="WaterMarkedTextBox"
    TagPrefix="crux" %>
<%@ Register Src="../Controls/Common/ErrorNotification.ascx" TagName="ErrorNotification"
    TagPrefix="crux" %>
<%@ Register Src="../Controls/Common/ManagedEntityName.ascx" TagName="ManagedEntityName"
    TagPrefix="crux" %>
<%@ Register Src="../Controls/Common/TableSortSearchPagination.ascx" TagName="TableSortSearchPagination"
    TagPrefix="uc1" %>
<%@ Register Src="../Controls/Common/AdditionalButtonsOnGrid.ascx" TagName="AdditionalButtonsOnGrid"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <!-- 
        CreativeToDo: The Text Boxes On This Page Don't Change Their BackGround Like Login Page 
             when Validations are not satified 
        -->
    <asp:UpdatePanel ID="updUpdate" runat="server">
        <ContentTemplate>
            <crux:ManagedEntityName PreceedingText="You are currently managing:" ID="lblManagedCompanyName"
                ShowEntityURL="true" EntityType="Company" runat="server" />
            <table>
                <tr>
                    <td height="12">
                    </td>
                </tr>
            </table>
            <asp:Panel ID="pnlList" runat="server">
                <asp:Panel ID="pnlAddUser" runat="server">
                    <table cellpadding="0" cellspacing="0" class="toolbar">
                        <tr>
                            <td style="border: 0px">
                                <asp:ImageButton ID="btnAddNewUser" runat="server" OnClick="btnAddNewUser_Click"
                                    meta:resourcekey="btnAddNewUserResource1" />
                                &nbsp;<asp:ImageButton ID="btnBack" Text="Back" runat="server" OnClick="btnBack_Click"
                                    ImageUrl="~/appimages/back.gif" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
                <table>
                    <tr>
                        <td height="12">
                        </td>
                    </tr>
                </table>
                <uc1:TableSortSearchPagination ID="TableSortSearchPagination1" TargetControlID="grdUsers"
                    runat="server" ExcludeSortColumnCsv="5" />
                <asp:GridView ID="grdUsers" runat="server" OnRowDataBound="grdUsers_RowDataBound"
                    SkinID="Paginate" AutoGenerateColumns="False">
                    <Columns>
                        <asp:BoundField DataField="UserID" HeaderText="ID" ItemStyle-CssClass="GridFirstColumn" />
                        <asp:BoundField DataField="UserName" HeaderText="User Name" />
                        <asp:BoundField DataField="FirstName" HeaderText="First Name" />
                        <%--<asp:BoundField DataField="MiddleName" Visible="false" HeaderText="Middle Name" />--%>
                        <asp:BoundField DataField="LastName" HeaderText="Last Name" />
                        <asp:BoundField DataField="UserComments" HeaderText="Comments" />
                        <asp:TemplateField HeaderText="Actions" ItemStyle-CssClass="ActionButtons">
                            <ItemTemplate>
                                <center>
                                    <asp:Panel runat="server" ID="pnlEditDeleteUser">
                                        <table>
                                            <tr>
                                                <asp:Panel runat="server" ID="pnlEditUser">
                                                    <td style="border: 0px">
                                                        <asp:ImageButton ID="btnItemEditIcon" runat="server" CausesValidation="false" CommandName="EditItem"
                                                            OnCommand="grdUsers_RowCommand" CommandArgument='<%#Eval("UserID")%>' ImageUrl="~/appimages/edit_user.gif"
                                                            ToolTip='<%# "Edit " + Resources.Strings.UserText %>' />
                                                    </td>
                                                </asp:Panel>
                                                <asp:Panel runat="server" ID="pnlResetUserPassword">
                                                    <td style="border: 0px">
                                                        <asp:ImageButton ID="btnResetPassword" runat="server" CausesValidation="false" CommandName="OpenSecondView"
                                                            OnCommand="grdUsers_RowCommand" CommandArgument='<%#Eval("UserID")%>' ImageUrl="~/appimages/reset_user_password.gif"
                                                            ToolTip='<%# "Reset " + Resources.Strings.UserText + " Password" %>' />
                                                    </td>
                                                </asp:Panel>
                                                <asp:Panel runat="server" ID="pnlDeleteUser">
                                                    <td style="border: 0px">
                                                        <asp:ImageButton ID="btnItemDelete" runat="server" CausesValidation="false" CommandName="DeleteItem"
                                                            OnCommand="grdUsers_RowCommand" CommandArgument='<%#Eval("UserID")%>' ImageUrl="~/appImages/delete.gif"
                                                            ToolTip='<%# "Delete " + Resources.Strings.UserText %>' />
                                                    </td>
                                                </asp:Panel>
                                                <asp:Panel runat="server" ID="pnlEditUserDetail">
                                                    <td style="border: 0px">
                                                        <asp:ImageButton ID="btnManageUserDetails" runat="server" CausesValidation="false"
                                                            CommandName="OpenView" OnCommand="grdUsers_RowCommand" CommandArgument='<%#Eval("UserID")%>'
                                                            ImageUrl="~/appimages/edit_user_details.gif" ToolTip='<%# "Edit " +  Resources.Strings.UserText + " Details" %>' />
                                                    </td>
                                                </asp:Panel>
                                                <asp:Panel runat="server" ID="pnlAdditionalConfigurationBasedButtons">
                                                    <td style="border: 0px">
                                                        <uc1:AdditionalButtonsOnGrid runat="server" ObjectID='<%#Eval("UserID")%>' GridName="ManageUsers" />
                                                    </td>
                                                </asp:Panel>
                                            </tr>
                                        </table>
                                    </asp:Panel>
                                </center>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </asp:Panel>
            <asp:Panel ID="pnlAddEdit" runat="server">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td class="formTxtHeader" colspan="2">
                            <%= Resources.Strings.UserText %>
                        </td>
                    </tr>
                    <tr>
                        <td class="formLine" colspan="2">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formGroupGap">
                        </td>
                    </tr>
                    <!-- User ID -->
                    <tr>
                        <td align="right" valign="middle" class="formLeftColmnWidth">
                            <asp:Label ID="lblUserID" runat="server" Text='<%# Resources.Strings.UserText + " ID:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <asp:Label ID="lblUserIDValue" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- User Name -->
                    <tr>
                        <td align="right" valign="middle" class="formLeftColmnWidth">
                            <asp:Label ID="lblUserName" runat="server" Text='<%# Resources.Strings.UserText + " Name:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtUserName" WaterMarkText="User Name" ValueRequired="true"
                                CheckEmailFormat="true" ErrorText="User Name is required and should be a valid email address."
                                Width="180" MaxLength="50" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- User FirstName -->
                    <tr>
                        <td align="right" valign="middle" class="formLeftColmnWidth">
                            <asp:Label ID="lblFirstName" runat="server" Text="First Name:" CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtFirstName" WaterMarkText="First Name" ValueRequired="true"
                                ErrorText="First Name is required." Width="180" MaxLength="200" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- User LastName -->
                    <tr>
                        <td align="right" valign="middle" class="formLeftColmnWidth">
                            <asp:Label ID="lblLastName" runat="server" Text="Last Name:" CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtLastName" WaterMarkText="Last Name" ValueRequired="true"
                                ErrorText="Last Name is required." Width="180" MaxLength="200" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- User Comments -->
                    <tr>
                        <td align="right" valign="top" class="formLeftColmnWidth formPaddingTop">
                            <asp:Label ID="lblUserComments" runat="server" Text='<%# Resources.Strings.UserText + " Comments:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtUserComments" WaterMarkText="User Comments" ValueRequired="false"
                                MaxLength="10" TextMode="MultiLine" Width="180" Height="30" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formGroupGap">
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td align="left">
                            <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" />
                            &nbsp;
                            <asp:Button ID="btnCancel" CausesValidation="false" runat="server" Text="Cancel"
                                OnClick="btnCancel_Click" />
                        </td>
                    </tr>
                    <!-- User MiddleName -->
                    <tr style="visibility: hidden">
                        <td align="right" valign="middle" class="formLeftColmnWidth">
                            <asp:Label ID="lblMiddleName" Visible="false" runat="server" Text="Middle Name:"
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox Visible="false" ID="txtMiddleName" WaterMarkText="Middle Name"
                                ValueRequired="false" Width="180" MaxLength="200" runat="server" />
                        </td>
                    </tr>
                    <tr style="visibility: hidden">
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <br />
            <crux:ErrorNotification ID="pnlError" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
